extends Generate



# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	if player:
		player.called.connect(creat_warrior)
	
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta: float) -> void:
	pass

func _physics_process(delta: float) -> void:
	Generate_time+=delta
	if Generate_time > Generate_interval:
		creat_enemy(get_random_position())
		Generate_time = 0
	pass


func creat_enemy(new_position,new_speed = 1000,new_scale=Vector2(0.03,0.03)):
	var enemy = BOAR.instantiate()
	enemy.position = new_position
	enemy.speed = new_speed
	enemy.scale = new_scale
	enemy.successfully_hit.connect(successfulattack)
	self.add_child(enemy)

func creat_warrior(new_position,new_speed = 1000,new_scale=Vector2(0.3,0.3)):
	var warrior = WARRIOR.instantiate()
	warrior.position = new_position
	warrior.speed = new_speed
	warrior.scale = new_scale
	self.add_child(warrior)
